﻿<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>通用增删改查</title>

    <link href="/plugins/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/plugins/material-design-iconic-font-2.2.0/css/material-design-iconic-font.min.css"
          rel="stylesheet"/>
    <link href="/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet"/>

    <link href="/plugins/bootstrap-table-1.11.0/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="/plugins/waves-0.7.5/waves.min.css" rel="stylesheet"/>
    <link href="/plugins/jquery-confirm/jquery-confirm.min.css" rel="stylesheet"/>

    <!--ztree-->
    <link href="/plugins/zTree/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="/plugins/zTree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />


    <style>
        ul.ztree {
            width: 100%;
            height: 100%;
            background-color: #FFF;
            border: none;
        }
        .tree-lab{
            padding-bottom: 5px;
        }
    </style>

    <link href="/app/css/common.css" rel="stylesheet"/>
</head>
<body>
<div id="main">
    <table id="table"></table>
</div>

<script src="/plugins/jquery.1.12.4.min.js"></script>
<script src="/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
<script src="/plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
<script src="/plugins/bootstrap-table-1.11.0/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="/plugins/waves-0.7.5/waves.min.js"></script>
<script src="/plugins/jquery-confirm/jquery-confirm.min.js"></script>
<script src="https://cdn.bootcss.com/moment.js/2.18.1/moment.min.js"></script>

<!--tree-->
<script src="/plugins/zTree/js/jquery.ztree.core.min.js" type="text/javascript"></script>
<script src="/plugins/zTree/js/jquery.ztree.excheck.min.js" type="text/javascript"></script>

<script src="/plugins/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js"></script>

<script src="/app/js/common.js"></script>
<script src="/app/js/i-ajax.js"></script>
<script>
    var $table = $('#table');
    $(function () {
        jconfirm.defaults = {
            theme: 'material',
        };
        // bootstrap table初始化
        // http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
        $table.bootstrapTable({
            url: '/api/logs',
            height: getHeight(),
            striped: true,
            search: true,
            searchOnEnterKey: true,
            showRefresh: true,
            showToggle: true,
            showColumns: true,
            minimumCountColumns: 2,
//            showPaginationSwitch: true,
            clickToSelect: true,
            pageSize: 20,
            pageList: [10, 20, 25, 50, 100],
//            detailView: true,
//            detailFormatter: 'detailFormatter',
            pagination: true,
            paginationLoop: false,
            classes: 'table table-hover table-no-bordered',
            sidePagination: "server",
            silentSort: false,
            smartDisplay: false,
            idField: 'id',
            sortName: 'id',
            sortOrder: 'desc',
            escape: true,
            maintainSelected: true,
            toolbar: '#toolbar',
            columns: [
                {field: 'state', checkbox: true},
                //   {field: 'avatar', title: '头像',  formatter: 'avatarFormatter', align: 'center'},
                {field: 'title', title: '日志标题', sortable: true, align: 'center'},
                {field: 'reqUri', title: '请求路径', sortable: true, align: 'center'},
                {field: 'reqMethod', title: '请求方法', sortable: true, align: 'center'},
                {field: 'controller', title: '控制器', sortable: true, align: 'center'},
                {field: 'methodName', title: '方法', sortable: true, align: 'center'},
                {field: 'username', title: '操作人', sortable: true, align: 'center'},
                {field: 'addressIp', title: 'id地址', sortable: true, align: 'center'},
                {field: 'browserName', title: '浏览器', sortable: true, align: 'center'},
                {field: 'exceptionInfo', title: '异常信息', sortable: true, align: 'center'},
                {field: 'executeUseMillisecond', title: '耗时(ms)', sortable: true, align: 'center'},
                {field: 'createdDate', title: '创建时间', sortable: true, formatter: 'dateFormatter', align: 'center'},
            ],
            queryParams: function (params) {
                return {
                    size: params.limit,
                    page: params.offset / params.limit,
                    sort: params.sort + ',' + params.order
                };
            },
            responseHandler: function (data) {
                return {total: data.totalElements, rows: data.content};
            }
        }).on('all.bs.table', function (e, name, args) {
            $('[data-toggle="tooltip"]').tooltip();
            $('[data-toggle="popover"]').popover();
        });
    });
    function dateFormatter(date) {
        return date ? moment(date).format("YYYY-MM-DD HH:mm:ss") : '-';
    }
</script>
</body>
</html>